import pickle
import numpy as np
import pandas as pd
import csv

#输出文件
train_output=open('train_AgeGender.csv','w',encoding='utf-8',newline="")
train_output_wrt=csv.writer(train_output)
test_output=open('test_AgeGender.csv','w',encoding='utf-8',newline="")
test_output_wrt=csv.writer(test_output)


#输入文件
data_train_visit=np.array(pickle.load(open("data_train_3digit.pkl",'rb')))
test_data_train_visit=np.array(pickle.load(open("data_test_3digit.pkl",'rb')))
train_list=[]
test_list=[]

for i in data_train_visit:
    train_list.append(i[4])
    #train_output_wrt.writerow(i[4])
for i in test_data_train_visit:
    test_list.append(i[4])
    #test_output_wrt.writerow(i[4])


print(train_list)
print(len(train_list))
print(test_list)
print(len(test_list))

train_output_wrt.writerows(train_list)
test_output_wrt.writerows(test_list)
